library(ggplot2)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ tibble  3.1.0     ✓ purrr   0.3.4
## ✓ tidyr   1.1.3     ✓ stringr 1.4.0
## ✓ readr   1.4.0     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(arsenal)
library(data.table)
## 
## Attaching package: 'data.table'
## The following object is masked from 'package:purrr':
## 
##     transpose
## The following objects are masked from 'package:dplyr':
## 
##     between, first, last
library(expss)
## 
## Attaching package: 'expss'
## The following objects are masked from 'package:data.table':
## 
##     copy, like
## The following objects are masked from 'package:stringr':
## 
##     fixed, regex
## The following objects are masked from 'package:purrr':
## 
##     keep, modify, modify_if, transpose, when
## The following objects are masked from 'package:tidyr':
## 
##     contains, nest
## The following objects are masked from 'package:dplyr':
## 
##     between, compute, contains, first, last, na_if, recode, vars
## The following object is masked from 'package:ggplot2':
## 
##     vars
sleephygiene <- read_csv("/Users/Ivanics/Desktop/SPH/4th term/HealthComm/Qualtrics post/Sleep Hygiene Post-Survey_May 3, 2021_16.45.csv")
## 
## ── Column specification ────────────────────────────────────────────────────────
## cols(
##   .default = col_character()
## )
## ℹ Use `spec()` for the full column specifications.
sleephygiene$StartDate <- lubridate::ymd_hms(sleephygiene$StartDate)
## Warning: 2 failed to parse.
#Filter to include only responses beyond this time
sleephygiene <- sleephygiene %>% filter(StartDate >= "2021-04-29 00:00:00")

#Select out the variables we need
sleephygiene <- sleephygiene %>% select(Progress, `Duration (in seconds)`, Finished, LocationLatitude, LocationLongitude, DistributionChannel, UserLanguage, Q1, Q2, Q3, Q2_5_TEXT, Q4, Q5, Q6, Q37, Q92, Q93, Q94,  Q38, Q39, Q10_2, Q10_3, Q9, Q61, Q84, Q85, Q81, Q63, Q96_1, Q96_2, Q96_3, Q96_4, Q96_5, Q96_6, Q96_7, Q96_8, Q95, Q83, Q82, Q69, Q62, Q64, Q90, Q91, Q89_1, Q67_1, Q67_2, Q67_3, Q75_1, Q75_2, Q75_3, Q68, Q70, Q70_18_TEXT, Q87, Q71, Q72, Q79, Q79_5_TEXT, Q74, Q73, Q73_5_TEXT, Q59_1, Q59_2, Q59_3, Q59_4, Q44_1, Q44_2, Q44_3, Q44_4, Q44_5, Q44_6, Q44_7, Q44_8, Q44_9, Q52)

sleephygiene <- rowid_to_column(sleephygiene, "ID")
#General factor recoding
sleephygiene <- sleephygiene %>% mutate(
  Q1_consent = factor(Q1)) %>%
  mutate(Q2_program = factor(Q2)) %>%
  mutate(Q3_role = factor(Q3)) %>%
  mutate(Q4_gender = factor(Q4)) %>%
  mutate(Q5_age = factor(Q5)) %>%
  mutate(Q6_numberinhousehold = as.numeric(Q6)) %>%
  mutate(Q37_employed = factor(Q37)) %>%
  mutate(Q92_notSPHemployed = factor(Q92)) %>%
  mutate(Q93_worksetting = factor(Q93)) %>%
  mutate(Q94_dayornight = factor(Q94)) %>%
  mutate(Q38_worksetting = factor(Q38)) %>%
  mutate(Q39_dayornight = factor(Q39)) %>%
  mutate(Q10_hoursofsleeplast5workdays = as.numeric(Q10_2)) %>%
  mutate(Q10_hoursofsleeppastweekend = as.numeric(Q10_3)) %>%
  mutate(Q9_howoftensleepypastmonth = factor(Q9)) %>%
  mutate(Q61_howoftensleepypasttwoweeks = factor(Q61)) %>%
  mutate(Q84_awareofhowtoimprovesleepquality = factor(Q84)) %>%
  mutate(Q81_seenorheardfromGNbloombergcampaign = factor(Q81)) %>%
  mutate(Q63_recalltoolsfreetect = factor(Q63)) %>%
  mutate(Q96_picture1 = factor(Q96_1)) %>%
  mutate(Q96_picture2 = factor(Q96_2)) %>%
  mutate(Q96_picture3 = factor(Q96_3)) %>%
  mutate(Q96_picture4 = factor(Q96_4)) %>%
  mutate(Q96_picture5 = factor(Q96_5)) %>%
  mutate(Q96_picture6 = factor(Q96_6)) %>%
  mutate(Q96_picture7 = factor(Q96_7)) %>%
  mutate(Q96_picture8 = factor(Q96_8)) %>%
  mutate(Q95_talkedtoanyone = factor(Q95)) %>%
  mutate(Q82_knowanyonewhoengaged = factor(Q82)) %>%
  mutate(Q69_didyouengagewiththecampaign = factor(Q69)) %>%
  mutate(Q90_areyouhappywithyoursleepquality_awareofcampaign = factor(Q90)) %>%
  mutate(Q91_areyouhappywithyoursleepquality_notawareofcampaign = factor(Q91)) %>%
  mutate(Q89_ratesleepquality_notawareofcampaign = factor(Q89_1)) %>%
  mutate(Q67_move30minutes = as.numeric(Q67_1)) %>%
  mutate(Q67_breathing = as.numeric(Q67_2)) %>%
  mutate(Q67_powerdown = as.numeric(Q67_2)) %>%
  mutate(Q75_moving = factor(Q75_1)) %>%
  mutate(Q75_breathing = factor(Q75_2)) %>%
  mutate(Q75_powerdown = factor(Q75_3)) %>%
  mutate(Q68_timing = factor(Q68)) %>%
  mutate(Q87_idealtime = factor(Q87)) %>%
  mutate(Q74_rafflemotivating = factor(Q74)) %>%
  mutate(Q75_moving = factor(Q75_1)) %>%
  mutate(Q59_canmaintainhealthysleephabits = factor(Q59_1)) %>%
  mutate(Q59_cancutoutscreen = factor(Q59_2)) %>%
  mutate(Q59_canexercise = factor(Q59_3)) %>%
  mutate(Q59_canparticipateinbreathing = factor(Q59_4)) %>%
  mutate(Q44_goodnightsleepisimportant = factor(Q44_1)) %>%
  mutate(Q44_mentalclarity = factor(Q44_2)) %>%
  mutate(Q44_feelpositive = factor(Q44_3)) %>%
  mutate(Q44_cuttingoutscreenleadstobettersleep = factor(Q44_4)) %>%
  mutate(Q44_exercisingleadstobettersleep = factor(Q44_5)) %>%
  mutate(Q44_breathingexercisesleadstobettersleep = factor(Q44_6)) %>%
  mutate(Q44_iwillstopscreens = factor(Q44_7)) %>%
  mutate(Q44_iwillexercise = factor(Q44_8)) %>%
  mutate(Q44_iwillbreathe = factor(Q44_9)) %>%
  mutate(Q52_additionalcomments = factor(Q52))
#Q85
resp.split_85 <- strsplit(sleephygiene$Q85, ",")
lev <- unique(unlist(resp.split_85))
sleephygiene<- with(sleephygiene, data.frame(sleephygiene, t(sapply(resp.split_85, function(x) table(factor(x, levels=lev))))))

sleephygiene <- sleephygiene %>%
    mutate(Q85_waystoimprovesleepquality = case_when(
    Not.drinking.caffeinated.beverages.late.in.the.day == 1 ~ "Not drinking caffeinated beverages late in the day",
    Switching.off.electronics.one.hour.before.sleep == 1 ~ "Switching off electronics one hour before sleep",
    Incorporating.moderate.exercise.as.part.of.your.day == 1 ~ "Incorporating moderate exercise as part of your day",
    Increase.natural.bright.light.exposure.in.the.day == 1 ~ "Increase natural bright light exposure in the day",
    Reduce.irregular.or.long.daytime.naps == 1 ~ "Reduce irregular or long daytime naps",
    Try.to.sleep.and.wake.at.consistent.times == 1 ~ "Try to sleep and wake at consistent times",
    Take.a.melatonin.supplement == 1 ~ "Take a melatonin supplement",
    Decrease.alcohol.consumption == 1 ~ "Decrease alcohol consumption",
    Deep.breathing.exercises == 1 ~ "Deep breathing exercises"))

#Q83
resp.split_83 <- strsplit(sleephygiene$Q83, ",")
lev <- unique(unlist(resp.split_83))
sleephygiene<- with(sleephygiene, data.frame(sleephygiene, t(sapply(resp.split_83, function(x) table(factor(x, levels=lev))))))

sleephygiene <- sleephygiene %>%
    mutate(Q83_talkedtowho = case_when(
    Friends == 1 ~ "Friends",
    Spouse == 1 ~ "Spouse",
    Relatives == 1 ~ "Relatives",
    Colleague == 1 ~ "Colleague"))

#Q62
resp.split_62 <- strsplit(sleephygiene$Q62, ",")
lev <- unique(unlist(resp.split_62))
sleephygiene<- with(sleephygiene, data.frame(sleephygiene, t(sapply(resp.split_62, function(x) table(factor(x, levels=lev))))))

sleephygiene <- sleephygiene %>%
    mutate(Q62_howdidyouengage = case_when(
    Instagram.campaign == 1 ~ "Instagram campaign",
    Text.message.campaign == 1 ~ "Text message campaign",
    Word.of.mouth.discussion.with.others == 1 ~ "Word of mouth/discussion with others"))

#64
resp.split_64 <- strsplit(sleephygiene$Q64, ",")
lev <- unique(unlist(resp.split_64))
sleephygiene<- with(sleephygiene, data.frame(sleephygiene, t(sapply(resp.split_64, function(x) table(factor(x, levels=lev))))))

sleephygiene <- sleephygiene %>%
    mutate(Q64_whichtechniquedidyoutry = case_when(
    X.MoveMore == 1 ~ "Movemore",
    X.Breathe== 1 ~ "Breathe",
    X.PowerDown == 1 ~ "Powerdown",
    None.of.the.above == 1 ~ "None of the above"))

#70
resp.split_70 <- strsplit(sleephygiene$Q70, ",")
lev <- unique(unlist(resp.split_70))
sleephygiene<- with(sleephygiene, data.frame(sleephygiene, t(sapply(resp.split_70, function(x) table(factor(x, levels=lev))))))

sleephygiene <- sleephygiene %>%
    mutate(Q70_timingoftextsinconvenient = case_when(
    #Messages.were.too.frequent == 1 ~ "Messages were too frequent",
    Messages.were.too.infrequent== 1 ~ "Messages were too infrequent",
    Received.message.too.early.in.the.day == 1 ~ "Received message too early in the day",
    #Received.message.too.late.in.the.day == 1 ~ "Received message too late in the day",
    Other..please.explain.below. == 1 ~ "Other (please explain below)"))

#71
resp.split_71 <- strsplit(sleephygiene$Q71, ",")
lev <- unique(unlist(resp.split_71))
sleephygiene<- with(sleephygiene, data.frame(sleephygiene, t(sapply(resp.split_71, function(x) table(factor(x, levels=lev))))))

sleephygiene <- sleephygiene %>%
    mutate(Q71_whichchannelmosteducational = case_when(
    Text == 1 ~ "Text",
    Instagram == 1 ~ "Instagram"))
    #Discussion.with.others.about.the.campaign == 1 ~ "Discussion with others about the campaign",
    #None.of.the.above.1 == 1 ~ "None of the above"))

#72 - look into


#Q79
resp.split_79 <- strsplit(sleephygiene$Q79, ",")
lev <- unique(unlist(resp.split_79))
sleephygiene<- with(sleephygiene, data.frame(sleephygiene, t(sapply(resp.split_79, function(x) table(factor(x, levels=lev))))))

sleephygiene <- sleephygiene %>%
    mutate(Q79_moresuccessfuloutcomsuggestions = case_when(
    There.was.an.in.person.on.campus.component.to.the.campaign == 1 ~ "There was an in-person/on-campus component to the campaign",
    The.campaign.was.longer == 1 ~ "The campaign was longer",
    I.had.more.flexibility.in.my.day == 1 ~ "I had more flexibility in my day",
    There.were.subject.matter.experts.checking.in.with.me.one.on.one == 1 ~ "There were subject matter experts checking in with me one-on-one"))
    #Other == 1 ~ "Reduce irregular or long daytime naps",

#Q73
resp.split_73 <- strsplit(sleephygiene$Q73, ",")
lev <- unique(unlist(resp.split_73))
sleephygiene<- with(sleephygiene, data.frame(sleephygiene, t(sapply(resp.split_73, function(x) table(factor(x, levels=lev))))))

sleephygiene <- sleephygiene %>%
    mutate(Q73_hearabouthow = case_when(
    Instagram.1 == 1 ~ "Instagram",
    JHSPH.Activities.email == 1 ~ "JHSPH Activities email",
    #Class.announcement == 1 ~ "Class announcement",
    Word.of.mouth.discussion.with.others.1 == 1 ~ "Word of mouth/discussion with others"))
    #Other == 1 ~ "Reduce irregular or long daytime naps",

Plots for wakeup and sleep times

library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
workdayssleep <- sleephygiene %>% ggplot( aes(x=Q10_hoursofsleeplast5workdays)) +
    geom_histogram( binwidth=1, fill="#69b3a2", color="#e9ecef", alpha=0.9) +
    ggtitle("Hours of sleep last five workdays") +
    theme(
      plot.title = element_text(size=32)
    ) +
  labs(x="Number of hours of sleep in the past five workdays", y="Number of participants")
ggplotly(workdayssleep)
## Warning: Removed 2 rows containing non-finite values (stat_bin).
#Plot for weekend
weekend <- sleephygiene %>% ggplot( aes(x=Q10_hoursofsleeppastweekend)) +
    geom_histogram( binwidth=1, fill="#69b3a2", color="#e9ecef", alpha=0.9) +
    ggtitle("Hours of sleep last weekend") +
    theme(
      plot.title = element_text(size=32)
    ) +
  labs(x="Number of hours of sleep in the past weekend", y="Number of participants")
ggplotly(weekend)
## Warning: Removed 2 rows containing non-finite values (stat_bin).
#Tab 1
sleephygiene$Q9_howoftensleepypastmonth <- factor(sleephygiene$Q9_howoftensleepypastmonth, levels = c("Never", "Rarely", "Sometimes", "Very often", "Always"))
sleephygiene$Q61_howoftensleepypasttwoweeks <- factor(sleephygiene$Q61_howoftensleepypasttwoweeks, levels = c("Never", "Rarely", "Sometimes", "Very often", "Always"))
sleephygiene$Q89_ratesleepquality_notawareofcampaign <- factor(sleephygiene$Q89_ratesleepquality_notawareofcampaign, levels = c("Poor", "Fair", "Good", "Excellent"))
sleephygiene$Q75_moving <- factor(sleephygiene$Q75_moving, levels = c("Extremely unhelpful", "Somewhat unhelpful", "Neither helpful nor unhelpful", "Somewhat helpful", "Extremely helpful"))
sleephygiene$Q75_breathing <- factor(sleephygiene$Q75_breathing, levels = c("Extremely unhelpful", "Somewhat unhelpful", "Neither helpful nor unhelpful", "Somewhat helpful", "Extremely helpful"))
sleephygiene$Q75_powerdown <- factor(sleephygiene$Q75_powerdown, levels = c("Extremely unhelpful", "Somewhat unhelpful", "Neither helpful nor unhelpful", "Somewhat helpful", "Extremely helpful"))
sleephygiene$Q87_idealtime <- factor(sleephygiene$Q87_idealtime, levels = c("Early morning (6:00 am - 9:00 am)", "Late morning (9:01 am - 12:00 pm)", "Early afternoon (12:01 pm - 3:00 pm)", "Late afternoon (3:01 pm - 6:00 pm)", "Early evening (6:01 pm - 9:00 pm)", "Late evening (9:01 pm - 12:00 am)", "Other (please specify)"))
sleephygiene$Q59_canmaintainhealthysleephabits <- factor(sleephygiene$Q59_canmaintainhealthysleephabits, levels = c("Not at all confident", "Somewhat confident", "Extremely confident"))
sleephygiene$Q59_cancutoutscreen <- factor(sleephygiene$Q59_cancutoutscreen, levels = c("Not at all confident", "Somewhat confident", "Extremely confident"))
sleephygiene$Q59_canexercise <- factor(sleephygiene$Q59_canexercise, levels = c("Not at all confident", "Somewhat confident", "Extremely confident"))
sleephygiene$Q59_canparticipateinbreathing <- factor(sleephygiene$Q59_canparticipateinbreathing, levels = c("Not at all confident", "Somewhat confident", "Extremely confident"))
sleephygiene$Q44_goodnightsleepisimportant <- factor(sleephygiene$Q44_goodnightsleepisimportant, levels = c("Strongly disagree", "Somewhat disagree", "Neither agree nor disagree", "Somewhat agree", "Strongly agree"))
sleephygiene$Q44_mentalclarity <- factor(sleephygiene$Q44_mentalclarity, levels = c("Strongly disagree", "Somewhat disagree", "Neither agree nor disagree", "Somewhat agree", "Strongly agree"))
sleephygiene$Q44_feelpositive <- factor(sleephygiene$Q44_feelpositive, levels = c("Strongly disagree", "Somewhat disagree", "Neither agree nor disagree", "Somewhat agree", "Strongly agree"))
sleephygiene$Q44_cuttingoutscreenleadstobettersleep <- factor(sleephygiene$Q44_cuttingoutscreenleadstobettersleep, levels = c("Strongly disagree", "Somewhat disagree", "Neither agree nor disagree", "Somewhat agree", "Strongly agree"))
sleephygiene$Q44_exercisingleadstobettersleep <- factor(sleephygiene$Q44_exercisingleadstobettersleep, levels = c("Strongly disagree", "Somewhat disagree", "Neither agree nor disagree", "Somewhat agree", "Strongly agree"))
sleephygiene$Q44_breathingexercisesleadstobettersleep <- factor(sleephygiene$Q44_breathingexercisesleadstobettersleep, levels = c("Strongly disagree", "Somewhat disagree", "Neither agree nor disagree", "Somewhat agree", "Strongly agree"))
sleephygiene$Q44_iwillstopscreens <- factor(sleephygiene$Q44_iwillstopscreens, levels = c("Strongly disagree", "Somewhat disagree", "Neither agree nor disagree", "Somewhat agree", "Strongly agree"))
sleephygiene$Q44_iwillexercise <- factor(sleephygiene$Q44_iwillexercise, levels = c("Strongly disagree", "Somewhat disagree", "Neither agree nor disagree", "Somewhat agree", "Strongly agree"))
sleephygiene$Q44_iwillbreathe <- factor(sleephygiene$Q44_iwillbreathe, levels = c("Strongly disagree", "Somewhat disagree", "Neither agree nor disagree", "Somewhat agree", "Strongly agree"))

library(expss)
sleephygiene = apply_labels(sleephygiene,
                      Q3_role = "What is your role at Bloomberg",
                      Q4_gender = "Which best describes your gender identity?",
                      Q2_program = "What is your current program at Bloomberg?",
                      Q5_age = "How old are you?",
                      Q6_numberinhousehold = "How many people live in your household, including yourself?",
                      Q37_employed = "If you are a student at Bloomberg, are you currently employed outside of your education program?",
                      Q92_notSPHemployed = "Are you currently employed?",
                      Q93_worksetting = "Which of the following best describes your current work setting?",
                      Q94_dayornight = "Do you work day or night shifts?",
                      Q38_worksetting = "Which of the following best describes your current work setting?",
                      Q39_dayornight = "Do you work day or night shifts?",
                      Q10_hoursofsleeplast5workdays = "On average, how many hours of sleep did you get per night during the following periods of time: during the last 5 workdays?",
                      Q10_hoursofsleeppastweekend = "On average, how many hours of sleep did you get per night during the following periods of time: during the past weekend?",
                      Q9_howoftensleepypastmonth = "How often did you feel sleepy during the day in the past month?",
                      Q61_howoftensleepypasttwoweeks = "How often did you feel sleepy during the day during the past 2 weeks?",
                      Q84_awareofhowtoimprovesleepquality = "Do you know any ways a person can improve their sleep quality?",
                      Q85_waystoimprovesleepquality = "What are some of the ways to improve sleep quality that you know?",
                      Q81_seenorheardfromGNbloombergcampaign = "In the last two-three weeks have you heard, seen, or received any information from the #GoodnightBloomberg campaign led by JHSPH students promoting better sleep?",
                      Q63_recalltoolsfreetect = "Can you recall any specific tools, techniques, or resources from the campaign? Please describe below.",
                      Q96_picture1 = "Were these materials were utilized in our #GoodnightBloomberg campaign? Picture 1",
                      Q96_picture2 = "Were these materials were utilized in our #GoodnightBloomberg campaign? Picture 2",
                      Q96_picture3 = "Were these materials were utilized in our #GoodnightBloomberg campaign? Picture 3",
                      Q96_picture4 = "Were these materials were utilized in our #GoodnightBloomberg campaign? Picture 4",
                      Q96_picture5 = "Were these materials were utilized in our #GoodnightBloomberg campaign? Picture 5",
                      Q96_picture6 = "Were these materials were utilized in our #GoodnightBloomberg campaign? Picture 6",
                      Q96_picture7 = "Were these materials were utilized in our #GoodnightBloomberg campaign? Picture 7",
                      Q96_picture8 = "Were these materials were utilized in our #GoodnightBloomberg campaign? Picture 8",
                      Q95_talkedtoanyone = "Have you talked to anyone about the #GoodnightBloomberg campaign?",
                      Q83_talkedtowho = "Please indicate with whom you talked about #GoodnightBloomberg (check all that apply).",
                      Q82_knowanyonewhoengaged = "Do you know anyone who engaged in any way with the #GoodnightBloomberg campaign about promoting better sleep?",
                      Q69_didyouengagewiththecampaign = "Did you engage in any way with the #GoodnightBloomberg campaign led by JHSPH students during the past 2 weeks?",
                      Q62_howdidyouengage = "Please select which of the following parts of the #GoodnightBloomberg campaign you engaged in:",
                      Q64_whichtechniquedidyoutry = "Which of the following techniques did you try at least once in the last 2 weeks (choose all that apply)?", 
                      Q90_areyouhappywithyoursleepquality_awareofcampaign = "Are you happy with your sleep quality overall currently?", 
                      Q91_areyouhappywithyoursleepquality_notawareofcampaign = "Are you happy with your sleep quality overall currently?", 
                      Q89_ratesleepquality_notawareofcampaign = "Please rate your sleep quality from the following options: In the last two weeks? (on average)",
                      Q67_move30minutes =  "In the last two weeks, how many days did you participate in the following techniques? Move 30 minutes total per day",
                      Q67_breathing = "In the last two weeks, how many days did you participate in the following techniques? Use a breathing exercise",
                      Q67_powerdown = "In the last two weeks, how many days did you participate in the following techniques? Power down your screens (i.e. cell phone, tablet, computer, TV) 1 hour before bed",
                      Q75_moving = "How helpful did you find the following activities for getting better quality sleep in the past 2 weeks? Moving 30 minutes total per day",
                      Q75_breathing = "How helpful did you find the following activities for getting better quality sleep in the past 2 weeks? Using a breathing exercise",
                      Q75_powerdown = "How helpful did you find the following activities for getting better quality sleep in the past 2 weeks? Powering down your screens (i.e. cell phone, tablet, computer, TV) 1 hour before bed",
                      Q68_timing = "Was the timing of the texts/posts convenient for you to adopt the recommended activity? ",
                      Q70_timingoftextsinconvenient = "Please provide information below about why the timing of the texts/posts was inconvenient?", 
                      Q87_idealtime = "What would have been the ideal time to receive the message (EST/EDT)?",
                      Q71_whichchannelmosteducational = "Which channel did you find the most educational?",
                      Q79_moresuccessfuloutcomsuggestions = "I think I would have had a more successful outcome (e.g. better sleep quality) if (choose all that may apply):",
                      Q74_rafflemotivating = "Did you find the raffles motivating for participation in the #GoodnightBloomberg campaign?",
                      Q73_hearabouthow = "How did you hear about the #GoodnightBloomberg campaign?",
                      Q59_canmaintainhealthysleephabits = "Please tell us how confident you feel practicing the following behaviors in order to get better sleep: I can maintain healthy sleep habits.",
                      Q59_cancutoutscreen = "Please tell us how confident you feel practicing the following behaviors in order to get better sleep: I can cut out screen use 1 hour before bed.",
                      Q59_canexercise = "Please tell us how confident you feel practicing the following behaviors in order to get better sleep: I can exercise for 30 minutes total each day.", 
                      Q59_canparticipateinbreathing = "Please tell us how confident you feel practicing the following behaviors in order to get better sleep: I can participate in a breathing exercise during the day or before bed.", 
                      Q44_goodnightsleepisimportant = "Please rate your agreement with the following statements: Getting a good night's sleep is important to me.",
                      Q44_mentalclarity = "Please rate your agreement with the following statements: Having a regular sleep routine improves mental clarity/sharpness.",
                      Q44_feelpositive = "Please rate your agreement with the following statements: I feel positive about the quality of my sleep.",
                      Q44_cuttingoutscreenleadstobettersleep = "Please rate your agreement with the following statements: I think cutting out screen use 1 hour before bed leads to better sleep.",
                      Q44_exercisingleadstobettersleep = "Please rate your agreement with the following statements: I think exercising regularly leads to better sleep.",
                      Q44_breathingexercisesleadstobettersleep = "Please rate your agreement with the following statements: I think participating in breathing exercises during the day or before bed leads to better sleep.",
                      Q44_iwillstopscreens = "Please rate your agreement with the following statements: In the next two weeks, I will stop using screens 1 hour before bed for better sleep.",
                      Q44_iwillexercise = "Please rate your agreement with the following statements: In the next two weeks, I will exercise for at least 30 minutes total each day for better sleep.",
                      Q44_iwillbreathe = "Please rate your agreement with the following statements: In the next two weeks, I will do a daily breathing exercise for better sleep.",
                      Q52_additionalcomments = "Please share any additional comments or feedback you have about the #GoodnightBloomberg sleep campaign below."
                      )
attach(sleephygiene)
tab1 <- tableby(~ Q3_role + 
                  Q4_gender +
                  Q5_age +
                  Q6_numberinhousehold +
                  Q37_employed +
                  Q10_hoursofsleeplast5workdays +
                  Q10_hoursofsleeppastweekend +
                  Q9_howoftensleepypastmonth +
                  Q61_howoftensleepypasttwoweeks +
                  Q84_awareofhowtoimprovesleepquality +
                  Q81_seenorheardfromGNbloombergcampaign +
                  Q63_recalltoolsfreetect +
                  Q96_picture1 +
                  Q96_picture2 +
                  Q96_picture3 +
                  Q96_picture4 +
                  Q96_picture5 +
                  Q96_picture6 +
                  Q96_picture7 +
                  Q96_picture8 +
                  Q95_talkedtoanyone +
                  Q82_knowanyonewhoengaged +
                  Q69_didyouengagewiththecampaign +
                  Q67_move30minutes +
                  Q67_breathing +
                  Q67_powerdown +
                  Q68_timing + 
                  Q79_moresuccessfuloutcomsuggestions +
                  Q59_canmaintainhealthysleephabits +
                  Q59_cancutoutscreen +
                  Q59_canexercise +
                  Q59_canparticipateinbreathing +
                  Q44_goodnightsleepisimportant +
                  Q44_mentalclarity +
                  Q44_feelpositive +
                  Q44_cuttingoutscreenleadstobettersleep +
                  Q44_exercisingleadstobettersleep +
                  Q44_breathingexercisesleadstobettersleep +
                  Q44_iwillstopscreens +
                  Q44_iwillexercise +
                  Q44_iwillbreathe,
                data=sleephygiene, test=TRUE, total=TRUE, 
                numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab1, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)
Table 1. Baseline information
Overall (N=41)
What is your role at Bloomberg
   N-Miss 2
   Faculty/Staff Member 4 (10.3%)
   Full-time student 21 (53.8%)
   Part-time student 14 (35.9%)
Which best describes your gender identity?
   N-Miss 2
   Female 32 (82.1%)
   Male 6 (15.4%)
   Non-binary / third gender 1 (2.6%)
How old are you?
   N-Miss 2
   18-25 10 (25.6%)
   26-34 16 (41.0%)
   35-44 6 (15.4%)
   45-54 7 (17.9%)
How many people live in your household, including yourself?
   Median (Q1, Q3) 2.00 (2.00, 3.00)
If you are a student at Bloomberg, are you currently employed outside of your education program?
   N-Miss 2
   N/A - I am not a student at Bloomberg 4 (10.3%)
   No 19 (48.7%)
   Yes 16 (41.0%)
On average, how many hours of sleep did you get per night during the following periods of time: during the last 5 workdays?
   Median (Q1, Q3) 7.00 (6.00, 7.00)
On average, how many hours of sleep did you get per night during the following periods of time: during the past weekend?
   Median (Q1, Q3) 8.00 (7.00, 8.00)
How often did you feel sleepy during the day in the past month?
   N-Miss 13
   Never 1 (3.6%)
   Rarely 5 (17.9%)
   Sometimes 20 (71.4%)
   Very often 0 (0.0%)
   Always 2 (7.1%)
How often did you feel sleepy during the day during the past 2 weeks?
   N-Miss 10
   Never 2 (6.5%)
   Rarely 5 (16.1%)
   Sometimes 21 (67.7%)
   Very often 0 (0.0%)
   Always 3 (9.7%)
Do you know any ways a person can improve their sleep quality?
   N-Miss 1
   Yes 40 (100.0%)
In the last two-three weeks have you heard, seen, or received any information from the #GoodnightBloomberg campaign led by JHSPH students promoting better sleep?
   N-Miss 1
   Don’t know 5 (12.5%)
   No 15 (37.5%)
   Yes 20 (50.0%)
Can you recall any specific tools, techniques, or resources from the campaign? Please describe below.
   N-Miss 27
   #movemore

#breathe #poweroff | 1 (7.1%) | |   Breathe | 1 (7.1%) | |   deep breaths, exercise, power down phones 1-2 hours before bed | 1 (7.1%) | |   Emails about text campaign | 1 (7.1%) | |   I got one t4ext but I think I was supposed to respond–no more came | 1 (7.1%) | |   I received text messages with videos. | 1 (7.1%) | |   I remember an email with the graphic. | 1 (7.1%) | |   In the past 2 weeks, I’ve been consistently working out / dancing even if its for 20 minutes a day. Cycling in the evening has become a habit too (as gyms in India have been closed due to stringent lockdown owing to increased case load). #MoveMore has helped me sleep a little better and become more regular with my sleep routine. | 1 (7.1%) | |   moving more, turning off electronics | 1 (7.1%) | |   Moving, breathing techniques | 1 (7.1%) | |   No, but I did evaluate materials as part of the previous survey | 1 (7.1%) | |   Text messages, specifically encouraging deep breathing, exercises, and screen hygiene. | 1 (7.1%) | |   turning off devices, deep breathing, excercise | 1 (7.1%) | |   Zoom backgrounds | 1 (7.1%) | |Were these materials were utilized in our #GoodnightBloomberg campaign? Picture 1 | | |   N-Miss | 6 | |   No | 7 (20.0%) | |   Not sure | 25 (71.4%) | |   Yes | 3 (8.6%) | |Were these materials were utilized in our #GoodnightBloomberg campaign? Picture 2 | | |   N-Miss | 5 | |   Not sure | 18 (50.0%) | |   Yes | 18 (50.0%) | |Were these materials were utilized in our #GoodnightBloomberg campaign? Picture 3 | | |   N-Miss | 6 | |   No | 5 (14.3%) | |   Not sure | 28 (80.0%) | |   Yes | 2 (5.7%) | |Were these materials were utilized in our #GoodnightBloomberg campaign? Picture 4 | | |   N-Miss | 6 | |   No | 4 (11.4%) | |   Not sure | 26 (74.3%) | |   Yes | 5 (14.3%) | |Were these materials were utilized in our #GoodnightBloomberg campaign? Picture 5 | | |   N-Miss | 6 | |   No | 2 (5.7%) | |   Not sure | 26 (74.3%) | |   Yes | 7 (20.0%) | |Were these materials were utilized in our #GoodnightBloomberg campaign? Picture 6 | | |   N-Miss | 6 | |   No | 4 (11.4%) | |   Not sure | 30 (85.7%) | |   Yes | 1 (2.9%) | |Were these materials were utilized in our #GoodnightBloomberg campaign? Picture 7 | | |   N-Miss | 6 | |   No | 2 (5.7%) | |   Not sure | 29 (82.9%) | |   Yes | 4 (11.4%) | |Were these materials were utilized in our #GoodnightBloomberg campaign? Picture 8 | | |   N-Miss | 6 | |   No | 3 (8.6%) | |   Not sure | 30 (85.7%) | |   Yes | 2 (5.7%) | |Have you talked to anyone about the #GoodnightBloomberg campaign? | | |   N-Miss | 1 | |   No | 31 (77.5%) | |   Yes | 9 (22.5%) | |Do you know anyone who engaged in any way with the #GoodnightBloomberg campaign about promoting better sleep? | | |   N-Miss | 1 | |   No | 36 (90.0%) | |   Yes | 4 (10.0%) | |Did you engage in any way with the #GoodnightBloomberg campaign led by JHSPH students during the past 2 weeks? | | |   N-Miss | 1 | |   No | 27 (67.5%) | |   Yes | 13 (32.5%) | |In the last two weeks, how many days did you participate in the following techniques? Move 30 minutes total per day | | |   Median (Q1, Q3) | 9.00 (5.00, 12.00) | |In the last two weeks, how many days did you participate in the following techniques? Use a breathing exercise | | |   Median (Q1, Q3) | 4.00 (2.00, 6.50) | |In the last two weeks, how many days did you participate in the following techniques? Power down your screens (i.e. cell phone, tablet, computer, TV) 1 hour before bed | | |   Median (Q1, Q3) | 4.00 (2.00, 6.50) | |Was the timing of the texts/posts convenient for you to adopt the recommended activity? | | |   N-Miss | 14 | |   No | 10 (37.0%) | |   Yes | 17 (63.0%) | |I think I would have had a more successful outcome (e.g. better sleep quality) if (choose all that may apply): | | |   N-Miss | 14 | |   I had more flexibility in my day | 12 (44.4%) | |   The campaign was longer | 9 (33.3%) | |   There was an in-person/on-campus component to the campaign | 5 (18.5%) | |   There were subject matter experts checking in with me one-on-one | 1 (3.7%) | |Please tell us how confident you feel practicing the following behaviors in order to get better sleep: I can maintain healthy sleep habits. | | |   N-Miss | 3 | |   Not at all confident | 6 (15.8%) | |   Somewhat confident | 23 (60.5%) | |   Extremely confident | 9 (23.7%) | |Please tell us how confident you feel practicing the following behaviors in order to get better sleep: I can cut out screen use 1 hour before bed. | | |   N-Miss | 3 | |   Not at all confident | 19 (50.0%) | |   Somewhat confident | 11 (28.9%) | |   Extremely confident | 8 (21.1%) | |Please tell us how confident you feel practicing the following behaviors in order to get better sleep: I can exercise for 30 minutes total each day. | | |   N-Miss | 3 | |   Not at all confident | 4 (10.5%) | |   Somewhat confident | 17 (44.7%) | |   Extremely confident | 17 (44.7%) | |Please tell us how confident you feel practicing the following behaviors in order to get better sleep: I can participate in a breathing exercise during the day or before bed. | | |   N-Miss | 2 | |   Not at all confident | 4 (10.3%) | |   Somewhat confident | 24 (61.5%) | |   Extremely confident | 11 (28.2%) | |Please rate your agreement with the following statements: Getting a good night’s sleep is important to me. | | |   N-Miss | 3 | |   Strongly disagree | 0 (0.0%) | |   Somewhat disagree | 0 (0.0%) | |   Neither agree nor disagree | 1 (2.6%) | |   Somewhat agree | 6 (15.8%) | |   Strongly agree | 31 (81.6%) | |Please rate your agreement with the following statements: Having a regular sleep routine improves mental clarity/sharpness. | | |   N-Miss | 2 | |   Strongly disagree | 0 (0.0%) | |   Somewhat disagree | 0 (0.0%) | |   Neither agree nor disagree | 0 (0.0%) | |   Somewhat agree | 5 (12.8%) | |   Strongly agree | 34 (87.2%) | |Please rate your agreement with the following statements: I feel positive about the quality of my sleep. | | |   N-Miss | 3 | |   Strongly disagree | 5 (13.2%) | |   Somewhat disagree | 6 (15.8%) | |   Neither agree nor disagree | 7 (18.4%) | |   Somewhat agree | 16 (42.1%) | |   Strongly agree | 4 (10.5%) | |Please rate your agreement with the following statements: I think cutting out screen use 1 hour before bed leads to better sleep. | | |   N-Miss | 2 | |   Strongly disagree | 0 (0.0%) | |   Somewhat disagree | 1 (2.6%) | |   Neither agree nor disagree | 4 (10.3%) | |   Somewhat agree | 10 (25.6%) | |   Strongly agree | 24 (61.5%) | |Please rate your agreement with the following statements: I think exercising regularly leads to better sleep. | | |   N-Miss | 2 | |   Strongly disagree | 0 (0.0%) | |   Somewhat disagree | 0 (0.0%) | |   Neither agree nor disagree | 2 (5.1%) | |   Somewhat agree | 8 (20.5%) | |   Strongly agree | 29 (74.4%) | |Please rate your agreement with the following statements: I think participating in breathing exercises during the day or before bed leads to better sleep. | | |   N-Miss | 2 | |   Strongly disagree | 0 (0.0%) | |   Somewhat disagree | 0 (0.0%) | |   Neither agree nor disagree | 8 (20.5%) | |   Somewhat agree | 19 (48.7%) | |   Strongly agree | 12 (30.8%) | |Please rate your agreement with the following statements: In the next two weeks, I will stop using screens 1 hour before bed for better sleep. | | |   N-Miss | 4 | |   Strongly disagree | 9 (24.3%) | |   Somewhat disagree | 7 (18.9%) | |   Neither agree nor disagree | 3 (8.1%) | |   Somewhat agree | 8 (21.6%) | |   Strongly agree | 10 (27.0%) | |Please rate your agreement with the following statements: In the next two weeks, I will exercise for at least 30 minutes total each day for better sleep. | | |   N-Miss | 3 | |   Strongly disagree | 0 (0.0%) | |   Somewhat disagree | 2 (5.3%) | |   Neither agree nor disagree | 5 (13.2%) | |   Somewhat agree | 12 (31.6%) | |   Strongly agree | 19 (50.0%) | |Please rate your agreement with the following statements: In the next two weeks, I will do a daily breathing exercise for better sleep. | | |   N-Miss | 3 | |   Strongly disagree | 4 (10.5%) | |   Somewhat disagree | 9 (23.7%) | |   Neither agree nor disagree | 8 (21.1%) | |   Somewhat agree | 9 (23.7%) | |   Strongly agree | 8 (21.1%) |

#If student
student <- sleephygiene %>% filter(Q3_role %in% c("Part-time student", "Full-time student"))

tab2 <- tableby(~ Q2_program,
                data=student, test=TRUE, total=TRUE, 
                numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab2, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)
Table 1. Baseline information
Overall (N=35)
What is your current program at Bloomberg?
   Doctoral Student 9 (25.7%)
   Masters Student 24 (68.6%)
   Other 1 (2.9%)
   Post-doctoral student 1 (2.9%)
#If employed 
nonbloombergstudentemployed <- sleephygiene %>% filter(Q37_employed == "N/A - I am not a student at Bloomberg")

tab3 <- tableby(~ Q92_notSPHemployed,
                data=nonbloombergstudentemployed, test=TRUE, total=TRUE, 
                numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab3, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)
Table 1. Baseline information
Overall (N=4)
Are you currently employed?
   Yes 4 (100.0%)
#If employed and not bloomberg
employed <- nonbloombergstudentemployed %>% filter(Q92_notSPHemployed == "Yes")

tab4 <- tableby(~ Q93_worksetting,
                data=employed, test=TRUE, total=TRUE, 
                numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab4, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)
Table 1. Baseline information
Overall (N=4)
Which of the following best describes your current work setting?
   I sometimes work at home and sometimes at another location 2 (50.0%)
   I work from home 2 (50.0%)
#wfh not bloomberg
#wfhnotbloomberg <- nonbloombergstudentemployed %>% filter(Q93_worksetting == "I work in a location away from my home")

#tab5 <- tableby(~ Q94_dayornight,
#                data=wfhnotbloomberg, test=TRUE, total=TRUE, 
#                numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
#summary(tab5, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)

#student at bloomberg
studentemployed <- student %>% filter(Q37_employed == "Yes")

tab6 <- tableby(~ Q38_worksetting,
                data=studentemployed, test=TRUE, total=TRUE, 
                numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab6, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)
Table 1. Baseline information
Overall (N=16)
Which of the following best describes your current work setting?
   I sometimes work at home and sometimes at another location 5 (31.2%)
   I work from home 9 (56.2%)
   I work in a location away from my home 2 (12.5%)
studentemployedlocation <- student %>% filter(Q39_dayornight == "I work in a location away from my home")

#tab7 <- tableby(~ Q39_dayornight,
#                data=studentemployedlocation, test=TRUE, total=TRUE, 
#                numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
#summary(tab7, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)


#Aware of how to improve sleep quality
awareofsleepqualityimprovements <- sleephygiene %>% filter(Q84_awareofhowtoimprovesleepquality == "Yes")

tab8 <- tableby(~ Q85_waystoimprovesleepquality,
                data=awareofsleepqualityimprovements, test=TRUE, total=TRUE, 
                numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab8, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)
Table 1. Baseline information
Overall (N=40)
What are some of the ways to improve sleep quality that you know?
   N-Miss 1
   Not drinking caffeinated beverages late in the day 37 (94.9%)
   Switching off electronics one hour before sleep 1 (2.6%)
   Try to sleep and wake at consistent times 1 (2.6%)
#Talked to someone
talkedtosomeone <- sleephygiene %>% filter(Q95_talkedtoanyone == "Yes")

tab9 <- tableby(~ Q83_talkedtowho,
                data=talkedtosomeone, test=TRUE, total=TRUE, 
                numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab9, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)
Table 1. Baseline information
Overall (N=9)
Please indicate with whom you talked about #GoodnightBloomberg (check all that apply).
   N-Miss 1
   Colleague 1 (12.5%)
   Friends 5 (62.5%)
   Spouse 2 (25.0%)
#engaged in any way
engagedwiththecampaign <- sleephygiene %>% filter(Q69_didyouengagewiththecampaign == "Yes")

tab10 <- tableby(~ Q62_howdidyouengage +
                   Q64_whichtechniquedidyoutry +
                   Q90_areyouhappywithyoursleepquality_awareofcampaign +
                   Q75_moving +
                   Q75_breathing +
                   Q75_powerdown,
                data=engagedwiththecampaign, test=TRUE, total=TRUE, 
                numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab10, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)
Table 1. Baseline information
Overall (N=13)
Please select which of the following parts of the #GoodnightBloomberg campaign you engaged in:
   N-Miss 1
   Instagram campaign 7 (58.3%)
   Text message campaign 5 (41.7%)
Which of the following techniques did you try at least once in the last 2 weeks (choose all that apply)?
   Breathe 2 (15.4%)
   Movemore 9 (69.2%)
   None of the above 1 (7.7%)
   Powerdown 1 (7.7%)
Are you happy with your sleep quality overall currently?
   No 7 (53.8%)
   Yes 6 (46.2%)
How helpful did you find the following activities for getting better quality sleep in the past 2 weeks? Moving 30 minutes total per day
   N-Miss 5
   Extremely unhelpful 0 (0.0%)
   Somewhat unhelpful 0 (0.0%)
   Neither helpful nor unhelpful 0 (0.0%)
   Somewhat helpful 6 (75.0%)
   Extremely helpful 2 (25.0%)
How helpful did you find the following activities for getting better quality sleep in the past 2 weeks? Using a breathing exercise
   N-Miss 7
   Extremely unhelpful 0 (0.0%)
   Somewhat unhelpful 0 (0.0%)
   Neither helpful nor unhelpful 3 (50.0%)
   Somewhat helpful 2 (33.3%)
   Extremely helpful 1 (16.7%)
How helpful did you find the following activities for getting better quality sleep in the past 2 weeks? Powering down your screens (i.e. cell phone, tablet, computer, TV) 1 hour before bed
   N-Miss 9
   Extremely unhelpful 0 (0.0%)
   Somewhat unhelpful 0 (0.0%)
   Neither helpful nor unhelpful 2 (50.0%)
   Somewhat helpful 1 (25.0%)
   Extremely helpful 1 (25.0%)
#did not engagee in any way
noengagementwiththecampagin <- sleephygiene %>% filter(Q69_didyouengagewiththecampaign %in% c("No", "Don't know"))

tab11 <- tableby(~ Q91_areyouhappywithyoursleepquality_notawareofcampaign +
                   Q89_ratesleepquality_notawareofcampaign,
                data=noengagementwiththecampagin, test=TRUE, total=TRUE, 
                numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab11, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)
Table 1. Baseline information
Overall (N=27)
Are you happy with your sleep quality overall currently?
   N-Miss 8
   No 10 (52.6%)
   Yes 9 (47.4%)
Please rate your sleep quality from the following options: In the last two weeks? (on average)
   N-Miss 7
   Poor 3 (15.0%)
   Fair 6 (30.0%)
   Good 10 (50.0%)
   Excellent 1 (5.0%)
#not convenient 
notconvenient <- sleephygiene %>% filter(Q68_timing == "No")

tab12 <- tableby(~ Q70_timingoftextsinconvenient,
                data=noengagementwiththecampagin, test=TRUE, total=TRUE, 
                numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab12, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)
Table 1. Baseline information
Overall (N=27)
Please provide information below about why the timing of the texts/posts was inconvenient?
   N-Miss 19
   Messages were too infrequent 2 (25.0%)
   Other (please explain below) 5 (62.5%)
   Received message too early in the day 1 (12.5%)
#tooearlyintheday
tooearlyortoolate <- notconvenient %>% filter(Q70_timingoftextsinconvenient %in% c("Received message too early in the day", "Received message too late in the day"))

tab13 <- tableby(~ Q87_idealtime,
                data=tooearlyortoolate, test=TRUE, total=TRUE, 
                numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab13, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)
Table 1. Baseline information
Overall (N=1)
What would have been the ideal time to receive the message (EST/EDT)?
   Early morning (6:00 am - 9:00 am) 0 (0.0%)
   Late morning (9:01 am - 12:00 pm) 0 (0.0%)
   Early afternoon (12:01 pm - 3:00 pm) 0 (0.0%)
   Late afternoon (3:01 pm - 6:00 pm) 0 (0.0%)
   Early evening (6:01 pm - 9:00 pm) 1 (100.0%)
   Late evening (9:01 pm - 12:00 am) 0 (0.0%)
   Other (please specify) 0 (0.0%)
#whichmosteducational
instagramortext <- engagedwiththecampaign %>% filter(Q62_howdidyouengage %in% c("Instagram", "Text message campaign"))

#tab14 <- tableby(~ Q71_whichchannelmosteducational +
#                   Q72,
#                data=instagramortext, test=TRUE, total=TRUE, 
#                numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
#summary(tab14, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)

#instagram
instagram <- engagedwiththecampaign %>% filter(Q62_howdidyouengage == "Instagram campaign")

tab15 <- tableby(~ Q74_rafflemotivating,
                data=instagram, test=TRUE, total=TRUE, 
                numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab15, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)
Table 1. Baseline information
Overall (N=7)
Did you find the raffles motivating for participation in the #GoodnightBloomberg campaign?
   No 1 (14.3%)
   Yes 6 (85.7%)
#seenorheardofthecampiagn
seenordheard <- sleephygiene %>% filter(Q81_seenorheardfromGNbloombergcampaign == "Yes")

tab16 <- tableby(~ Q81_seenorheardfromGNbloombergcampaign,
                data=seenordheard, test=TRUE, total=TRUE, 
                numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab16, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)
Table 1. Baseline information
Overall (N=20)
In the last two-three weeks have you heard, seen, or received any information from the #GoodnightBloomberg campaign led by JHSPH students promoting better sleep?
   Don’t know 0 (0.0%)
   No 0 (0.0%)
   Yes 20 (100.0%)